﻿@model S4Store.Models.TelSaleReport.TelSellerIndexModel
@{
    ViewBag.Title = "Index";
    Layout = null;

    S4Store.Models.Chart.Column ChartModel = new S4Store.Models.Chart.Column();
    ChartModel.Name = "电话销售关键KPI概况";
    ChartModel.YAxis = "比率(%)";
    ChartModel.XAxis.Add("电话招徕成功率");
    ChartModel.XAxis.Add("试乘试驾率");
    ChartModel.XAxis.Add("试驾未成交率");
    ChartModel.XAxis.Add("登记客户成交率");
    ChartModel.XAxis.Add("上月客户转化率");
    ChartModel.XAxis.Add("超限价格成交率");
    S4Store.Models.Chart.ChartSeries series1 = new S4Store.Models.Chart.ChartSeries();
    series1.Name = "销售实绩";
    series1.Data.Add(Model.Report.SCLDDJLV);
    series1.Data.Add(Model.Report.SCSJLV);
    series1.Data.Add(Model.Report.SCSJCJLV);
    series1.Data.Add(Model.Report.DJKHCJLV);
    series1.Data.Add(Model.Report.SYKHZHLV);
    series1.Data.Add(Model.Report.CXJGCJLV);    
    ChartModel.Serieses.Add(series1);

    S4Store.Models.Chart.ChartSeries series2 = new S4Store.Models.Chart.ChartSeries();
    series2.Name = "考核目标";
    series2.Data.Add(Model.Report.SellerPerformanceStandard.DHZLDDLV);
    series2.Data.Add(Model.Report.SellerPerformanceStandard.SCSJLV);
    series2.Data.Add(Model.Report.SellerPerformanceStandard.SCSJCJLV);
    series2.Data.Add(Model.Report.SellerPerformanceStandard.DJKHCJLV);
    series2.Data.Add(Model.Report.SellerPerformanceStandard.SYKHZHLV);
    series2.Data.Add(Model.Report.SellerPerformanceStandard.CXJGCJLV);
    ChartModel.Serieses.Add(series2);

    List<S4Store.Models.Chart.RedGreenIndex> RedGreenIndexs = new List<S4Store.Models.Chart.RedGreenIndex>();
    S4Store.Models.Chart.RedGreenIndex r1 = new S4Store.Models.Chart.RedGreenIndex();
    r1.Url = Url.Action("SellerDataItem", new { Month = Model.BarModel.Month.ToString("yyyy-MM-01"), type = (int)S4Store.Models.TelSaleReport.SellerDataItemType.电话招徕成功率 });
    if(Model.Report.SCLDDJLV>=Model.Report.SellerPerformanceStandard.SCLDDJLV){
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Green;   
    }else{
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Red;   
    }
    r1.Size = S4Store.Models.Chart.RedGreenIndex.IndexSize.Small;
    r1.Title = "电话招徕成功率";
    RedGreenIndexs.Add(r1);

    r1 = new S4Store.Models.Chart.RedGreenIndex();
    r1.Url = Url.Action("SellerDataItem", new { Month = Model.BarModel.Month.ToString("yyyy-MM-01"), type = (int)S4Store.Models.TelSaleReport.SellerDataItemType.试乘试驾率 });
    if (Model.Report.SCSJLV >= Model.Report.SellerPerformanceStandard.SCSJLV)
    {
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Green;
    }
    else
    {
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Red;
    }
    r1.Size = S4Store.Models.Chart.RedGreenIndex.IndexSize.Small;
    r1.Title = "试乘试驾率";
    RedGreenIndexs.Add(r1);


    r1 = new S4Store.Models.Chart.RedGreenIndex();
    r1.Url = Url.Action("SellerDataItem", new { Month = Model.BarModel.Month.ToString("yyyy-MM-01"), type = (int)S4Store.Models.TelSaleReport.SellerDataItemType.试驾未成交率 });
    if (Model.Report.SCSJCJLV <= Model.Report.SellerPerformanceStandard.SCSJCJLV)
    {
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Green;
    }
    else
    {
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Red;
    }
    r1.Size = S4Store.Models.Chart.RedGreenIndex.IndexSize.Small;
    r1.Title = "试驾未成交率";
    RedGreenIndexs.Add(r1);


    r1 = new S4Store.Models.Chart.RedGreenIndex();
    r1.Url = Url.Action("SellerDataItem", new { Month = Model.BarModel.Month.ToString("yyyy-MM-01"), type = (int)S4Store.Models.TelSaleReport.SellerDataItemType.登记客户成交率 });
    if (Model.Report.DJKHCJLV >= Model.Report.SellerPerformanceStandard.DJKHCJLV)
    {
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Green;
    }
    else
    {
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Red;
    }
    r1.Size = S4Store.Models.Chart.RedGreenIndex.IndexSize.Small;
    r1.Title = "登记客户成交率";
    RedGreenIndexs.Add(r1);


    r1 = new S4Store.Models.Chart.RedGreenIndex();
    r1.Url = Url.Action("SellerDataItem", new { Month = Model.BarModel.Month.ToString("yyyy-MM-01"), type = (int)S4Store.Models.TelSaleReport.SellerDataItemType.上月客户转化率 });
    if (Model.Report.SYKHZHLV >= Model.Report.SellerPerformanceStandard.SYKHZHLV)
    {
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Green;
    }
    else
    {
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Red;
    }
    r1.Size = S4Store.Models.Chart.RedGreenIndex.IndexSize.Small;
    r1.Title = "上月客户转化率";
    RedGreenIndexs.Add(r1);


    r1 = new S4Store.Models.Chart.RedGreenIndex();
    r1.Url = Url.Action("SellerDataItem", new { Month = Model.BarModel.Month.ToString("yyyy-MM-01"), type = (int)S4Store.Models.TelSaleReport.SellerDataItemType.超限价格成交率 });
    if (Model.Report.CXJGCJLV < Model.Report.SellerPerformanceStandard.CXJGCJLV)
    {
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Green;
    }
    else
    {
        r1.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Red;
    }
    r1.Size = S4Store.Models.Chart.RedGreenIndex.IndexSize.Small;
    r1.Title = "超限价格成交率";
    RedGreenIndexs.Add(r1);
}
<div style="height:100%; overflow:auto">
@Html.Action("ReportBar", "Common", Model.BarModel)
<div style="position:relative; width:100%">      
        @Html.Partial("../Chart/Column", ChartModel)    
        @Html.Partial("../Chart/RedGreenIndex", RedGreenIndexs)    
</div>
</div>
